let str = "dssgraaaaaaaaaaa";
// 字符串里出现最多次的那个字符
function mostChar(str) {
    let obj = {};
    for (let item of str) {
        if (obj[item]) { // 对象已经存在该属性
            obj[item]++;
        } else { // 新属性
            obj[item] = 1;
        }
    }
    console.log(obj);
    let char = '',
        count = 0;
    for (let key in obj) {
        if (obj[key] > count) {
            count = obj[key];
            char = key;
        }
    }
    console.log(`${char}出现了${count}次`);
}
mostChar(str);


































if (!flag) {
    var flag = false;
    console.log(flag);
}

var flag;
if (!flag) {
    flag = false;
    console.log(flag);
}











let arr1 = [1, 2];
let arr2 = arr1;
arr2[0] = 3; // [3,2]
console.log(arr1); // 3,2
arr1 = [4, 5];
console.log(arr2); // 4,5











// a:11  b:1
function foo(a, b = 10) {
    if (a > b) {
        [a, b] = [b, a]; //a1  b11
    }
    return b - a;
}
console.log(foo(1)); // 9
console.log(foo(11)); // 1
console.log(foo(11, 1)); // 10


let obj = new Date();
let y = obj.getFullYear();
let m = obj.getMonth() + 1;
let d = obj.getDate();
let h = obj.getHours();
let min = obj.getMinutes();
let s = obj.getSeconds();








let a = 1;

function b() {
    a = 10;
    return;

    function a() {}
}
b();
console.log(a); // 10 1


let a = 1;

function b() {
    function a() {}
    a = 10;
    return;
}
b();
console.log(a); //  1











// 循环里称为死循环 递归 无限递归
function foo() {
    // console.log("heihei");
    foo();
}
foo();